home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / OBJ3D01.ZIP / FORMMVT.FR_ / FORMMVT.FR (.txt)
Encoding:
Visual Basic Form  |  1995-06-28  |  3.6 KB  |  123 lines

  1. VERSION 2.00
  2. Begin Form FormMvt 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Movement"
  5.    ClientHeight    =   4710
  6.    ClientLeft      =   1830
  7.    ClientTop       =   1800
  8.    ClientWidth     =   7365
  9.    Height          =   5115
  10.    Left            =   1770
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4710
  13.    ScaleWidth      =   7365
  14.    Top             =   1455
  15.    Width           =   7485
  16.    Begin HiTimer HiTime1 
  17.       Interval        =   100
  18.       Left            =   120
  19.       Top             =   120
  20.    End
  21.    Begin CommandButton CmdOk 
  22.       Caption         =   "Ok"
  23.       Height          =   495
  24.       Left            =   5880
  25.       TabIndex        =   1
  26.       Top             =   3960
  27.       Width           =   1335
  28.    End
  29.    Begin PictureBox PictureMvt 
  30.       Height          =   3135
  31.       Left            =   840
  32.       ScaleHeight     =   3105
  33.       ScaleWidth      =   5625
  34.       TabIndex        =   0
  35.       Top             =   720
  36.       Width           =   5655
  37.    End
  38.    Begin Label Label2 
  39.       BackStyle       =   0  'Transparent
  40.       Caption         =   "This show you how the Object3D lib can be used to create fast movement. This example use the HiresTimer Vbx."
  41.       Height          =   615
  42.       Left            =   960
  43.       TabIndex        =   3
  44.       Top             =   3960
  45.       Width           =   4095
  46.    End
  47.    Begin Label Label1 
  48.       Alignment       =   2  'Center
  49.       BackStyle       =   0  'Transparent
  50.       Caption         =   "Movement....."
  51.       FontBold        =   -1  'True
  52.       FontItalic      =   0   'False
  53.       FontName        =   "Arial"
  54.       FontSize        =   15
  55.       FontStrikethru  =   0   'False
  56.       FontUnderline   =   0   'False
  57.       Height          =   975
  58.       Left            =   840
  59.       TabIndex        =   2
  60.       Top             =   120
  61.       Width           =   5655
  62.    End
  63. Option Explicit
  64. Dim ax As Integer
  65. Dim Pos3D As pt_3d
  66. Dim DemoObj As Long
  67. Dim DemoView As Long
  68. Dim numstep As Integer
  69. Sub CmdOk_Click ()
  70.     Unload Me
  71. End Sub
  72. Sub Form_Load ()
  73.     numstep = 0
  74.     Show
  75.     DemoObj = objet3d_create()
  76.     DemoView = View3D_Create()
  77.     Call View3D_Elem_Add(DemoView, DemoObj)
  78.     Call view3d_setbuffer(DemoView, picturemvt.hWnd)
  79.     Call View3D_Set(DemoView, K_ID_BACKGROUND, 7)
  80. End Sub
  81. Sub Form_Unload (Cancel As Integer)
  82.     Call objet3d_delete(DemoObj)
  83.     Call view3d_delete(DemoView)
  84. End Sub
  85. Sub HiTime1_Timer ()
  86.     hitime1.Interval = 0
  87.     Call Move_Obj
  88.     hitime1.Interval = 50
  89. End Sub
  90. Sub Move_Obj ()
  91.     Pos3D.x = 0
  92.     Pos3D.y = -40
  93.     Pos3D.z = 0
  94.     ax = ax + 10
  95.     If numstep = 0 Then
  96.         Call Objet3D_LoadObj(DemoObj, ObjDir$ + "\hoover.m3d")
  97.         
  98.         Pos3D.x = 0
  99.         Pos3D.y = 0
  100.         Pos3D.z = 0
  101.         
  102.         Call Objet3D_Set(DemoObj, K_ID_FLG_SHADOW, CLng(0))
  103.     Else
  104.         If numstep >= 100 Then
  105.             If numstep = 100 Then
  106.                 Call Objet3D_LoadObj(DemoObj, ObjDir$ + "\helico.m3d")
  107.                 Call Objet3D_Set(DemoObj, K_ID_FLG_SHADOW, CLng(1))
  108.             End If
  109.             Pos3D.x = 0
  110.             Pos3D.y = 10 + 100 - 2 * (numstep - 100)
  111.             If numstep >= 150 Then Pos3D.y = 10
  112.             Pos3D.z = 0
  113.         
  114.             If numstep = 200 Then numstep = -1
  115.         End If
  116.     End If
  117.     numstep = numstep + 1
  118.     Call Objet3D_Set_Pos(DemoObj, Pos3D)
  119.     Call objet3d_set_angles(DemoObj, 0, ax, 0)
  120.     Call View3D_AffAll(DemoView)
  121.     Call View3D_Switch(DemoView, picturemvt.hDC)
  122. End Sub
  123.